package com.qidian.mes.defect.service.serviceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qidian.mes.defect.mapper.TaskMapper;
import com.qidian.mes.defect.service.TaskService;
import com.qidianit.common.pojo.MESResult;
import com.qidianit.mes.pojo.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author 泽华
 * @Description
 * @Time 2024-10-24 1:37
 */
@Service
public class TaskServiceImpl implements TaskService {
    @Autowired
    private TaskMapper taskMapper;


    @Override
    public MESResult list(Long documentsId,
                          String detectionName,
                          String materialNumber,
                          String materialName,
                          Long taskNumber,
                          String location,
                          int page,
                          int limit) {
        // 开启分页  参数1： 页码  参数2： 每页大小
        PageHelper.startPage(page,limit);
        // 查询全部
        List<Task> tasks = taskMapper.selectList(documentsId,detectionName,materialNumber,materialName,taskNumber,location);
        PageInfo<Task> pageInfo = new PageInfo<>(tasks);
        // 将pageInfo对象设置到MESResult中
        return MESResult.success(pageInfo);

    }
}
